/**
 * Created by haoran.shu on 2018/11/12 14:46.
 */
const supertest = require('supertest');
const req = supertest(require('../baseurl'));

describe('router_tactics', function () {

  describe('save_tactics', function () {

    it('save_tactics_success', function (done) {
      req.post('/tactics/save')
        .send({
          name: 'test',
          code: 'var a = 1;'
        })
        .expect(200)
        .end((err, res) => {
          if (err) {
            done(err);
          } else {
            console.log(res.body);
            done();
          }
        });
    });

  });

  describe('delete_tactics', () => {
    it('delete_tactics_success', function (done) {
      req.post('/tactics/delete').send({
        _id: '5bf4cacbbbfcdb1994977e02'
      }).expect(200, done);
    });
  });

  describe('update_tactics', () => {
    it('update_tactics_success', function (done) {
      req.post('/tactics/update').send({
        _id: '5bf4cacbbbfcdb1994977e02',
        name: 'update_test'
      }).expect(200, done);
    });
  });

  describe('info_tactics', () => {
    it('info_tactics_success', function (done) {
      req.get('/tactics/info')
        .query({_id: '5bf4cacbbbfcdb1994977e02'})
        .expect(200)
        .end((err, res) => {
          if (err) {
            done(err);
          } else {
            console.log(res.body);
            done();
          }
        });
    });
  });

});
